package com.ag.bean;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * TbUserDept entity.
 * 
 * @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "TB_USER_DEPT", schema = "dbo", catalog = "AGDB")
public class TbUserDept implements java.io.Serializable {

	// Fields

	private String udId;
	private TbUser tbUser;
	private TbUserDept tbUserDept;
	private TbDeptType tbDeptType;
	private String udName;
	private Integer udIf;
	private String udFax;
	private String udTel;
	private String udPhone;
	private String GId;
	private String GDesc;
	private String GCode;
	private String GAdmin;
	private String a;
	private String b;
	private String c;
	private Set<TbPropose> tbProposesForPAssistDept = new HashSet<TbPropose>(0);
	private Set<TbTask> tbTasks = new HashSet<TbTask>(0);
	private Set<TbUser> tbUsers = new HashSet<TbUser>(0);
	private Set<TbUserDept> tbUserDepts = new HashSet<TbUserDept>(0);
	private Set<TbPropose> tbProposesForPImplementPlan = new HashSet<TbPropose>(
			0);

	// Constructors

	/** default constructor */
	public TbUserDept() {
	}

	/** minimal constructor */
	public TbUserDept(String udId) {
		this.udId = udId;
	}

	/** full constructor */
	public TbUserDept(String udId, TbUser tbUser, TbUserDept tbUserDept,
			TbDeptType tbDeptType, String udName, Integer udIf, String udFax,
			String udTel, String udPhone, String a, String b, String c,
			Set<TbPropose> tbProposesForPAssistDept, Set<TbTask> tbTasks,
			Set<TbUser> tbUsers, Set<TbUserDept> tbUserDepts,
			Set<TbPropose> tbProposesForPImplementPlan) {
		this.udId = udId;
		this.tbUser = tbUser;
		this.tbUserDept = tbUserDept;
		this.tbDeptType = tbDeptType;
		this.udName = udName;
		this.udIf = udIf;
		this.udFax = udFax;
		this.udTel = udTel;
		this.udPhone = udPhone;
		this.a = a;
		this.b = b;
		this.c = c;
		this.tbProposesForPAssistDept = tbProposesForPAssistDept;
		this.tbTasks = tbTasks;
		this.tbUsers = tbUsers;
		this.tbUserDepts = tbUserDepts;
		this.tbProposesForPImplementPlan = tbProposesForPImplementPlan;
	}

	// Property accessors
	@Id
	@Column(name = "UD_ID", unique = true, nullable = false, length = 12)
	public String getUdId() {
		return this.udId;
	}

	public void setUdId(String udId) {
		this.udId = udId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "UD_UID")
	public TbUser getTbUser() {
		return this.tbUser;
	}

	public void setTbUser(TbUser tbUser) {
		this.tbUser = tbUser;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "UD_FID")
	public TbUserDept getTbUserDept() {
		return this.tbUserDept;
	}

	public void setTbUserDept(TbUserDept tbUserDept) {
		this.tbUserDept = tbUserDept;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "UD_TYPE")
	public TbDeptType getTbDeptType() {
		return this.tbDeptType;
	}

	public void setTbDeptType(TbDeptType tbDeptType) {
		this.tbDeptType = tbDeptType;
	}

	@Column(name = "UD_NAME", length = 50)
	public String getUdName() {
		return this.udName;
	}

	public void setUdName(String udName) {
		this.udName = udName;
	}

	@Column(name = "UD_IF")
	public Integer getUdIf() {
		return this.udIf;
	}

	public void setUdIf(Integer udIf) {
		this.udIf = udIf;
	}

	@Column(name = "UD_FAX", length = 20)
	public String getUdFax() {
		return this.udFax;
	}

	public void setUdFax(String udFax) {
		this.udFax = udFax;
	}

	@Column(name = "UD_TEL", length = 20)
	public String getUdTel() {
		return this.udTel;
	}

	public void setUdTel(String udTel) {
		this.udTel = udTel;
	}

	@Column(name = "UD_PHONE", length = 12)
	public String getUdPhone() {
		return this.udPhone;
	}

	public void setUdPhone(String udPhone) {
		this.udPhone = udPhone;
	}
	
	@Column(name = "G_ID", length = 50)
	public String getGId() {
		return this.GId;
	}

	public void setGId(String GId) {
		this.GId = GId;
	}

	@Column(name = "G_DESC", length = 500)
	public String getGDesc() {
		return this.GDesc;
	}

	public void setGDesc(String GDesc) {
		this.GDesc = GDesc;
	}

	@Column(name = "G_CODE", length = 50)
	public String getGCode() {
		return this.GCode;
	}

	public void setGCode(String GCode) {
		this.GCode = GCode;
	}

	@Column(name = "G_ADMIN", length = 300)
	public String getGAdmin() {
		return this.GAdmin;
	}

	public void setGAdmin(String GAdmin) {
		this.GAdmin = GAdmin;
	}


	@Column(name = "A", length = 60)
	public String getA() {
		return this.a;
	}

	public void setA(String a) {
		this.a = a;
	}

	@Column(name = "B", length = 60)
	public String getB() {
		return this.b;
	}

	public void setB(String b) {
		this.b = b;
	}

	@Column(name = "C", length = 60)
	public String getC() {
		return this.c;
	}

	public void setC(String c) {
		this.c = c;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbUserDeptByPAssistDept")
	public Set<TbPropose> getTbProposesForPAssistDept() {
		return this.tbProposesForPAssistDept;
	}

	public void setTbProposesForPAssistDept(
			Set<TbPropose> tbProposesForPAssistDept) {
		this.tbProposesForPAssistDept = tbProposesForPAssistDept;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbUserDept")
	public Set<TbTask> getTbTasks() {
		return this.tbTasks;
	}

	public void setTbTasks(Set<TbTask> tbTasks) {
		this.tbTasks = tbTasks;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "TB_USERDEPT_USER", schema = "dbo", catalog = "AGDB", joinColumns = { @JoinColumn(name = "UD_ID", nullable = false, updatable = true) }, inverseJoinColumns = { @JoinColumn(name = "U_ID", nullable = false, updatable = true) })
	public Set<TbUser> getTbUsers() {
		return this.tbUsers;
	}

	public void setTbUsers(Set<TbUser> tbUsers) {
		this.tbUsers = tbUsers;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbUserDept")
	public Set<TbUserDept> getTbUserDepts() {
		return this.tbUserDepts;
	}

	public void setTbUserDepts(Set<TbUserDept> tbUserDepts) {
		this.tbUserDepts = tbUserDepts;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tbUserDeptByPImplementPlan")
	public Set<TbPropose> getTbProposesForPImplementPlan() {
		return this.tbProposesForPImplementPlan;
	}

	public void setTbProposesForPImplementPlan(
			Set<TbPropose> tbProposesForPImplementPlan) {
		this.tbProposesForPImplementPlan = tbProposesForPImplementPlan;
	}

}